package com.va.yahooweather.entity;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;

public class YImage {
    private String url = "";
    private String title = "";
    private String link = "";
    private int width;
    private int height;

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getLink() {
        return link;
    }

    public void setLink(String link) {
        this.link = link;
    }

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    public int getHeight() {
        return height;
    }

    public void setHeight(int height) {
        this.height = height;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (obj == null || getClass() != obj.getClass()) {
            return false;
        }
        
        if (this == obj) {
            return true;
        }
        
        YImage target = (YImage) obj;
        return new EqualsBuilder()
            .append(getTitle(), target.getTitle())
            .append(getLink(), target.getLink())
            .append(getUrl(), target.getUrl())
            .append(getWidth(), target.getWidth())
            .append(getHeight(), target.getHeight())
            .isEquals();
    }

    @Override
    public int hashCode() {
        HashCodeBuilder h = new HashCodeBuilder(5, 51);
        h.append(getTitle());
        h.append(getUrl());
        h.append(getLink());
        h.append(getHeight());
        h.append(getWidth());
        return h.hashCode();
    }
}
